const express = require('express');
const app = express();
const indexRouter = require('./router/index').router;
const userRouter = require('./router/user').router;
const errHander = require('./router/errHander');

app.engine('art', require('express-art-template'));
app.set('views', __dirname + '/views');
app.set('view options', {
    debug: process.env.NODE_ENV !== 'production'
});

// mount the router on the app
app.use('/', indexRouter);
app.use('/user', userRouter);
app.use(errHander.logErrors);
app.use(errHander.clientErrorHandler);
app.use(errHander.errorHandler);
app.listen(3000, () => console.log('listen at port 3000!'));
